package com.shenghui.enterprise.base.controller;



import com.shenghui.enterprise.vo.Result;
import com.shenghui.enterprise.base.service.IBaseRoleUserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description: 角色用户关系表-role_user 前端控制器
 * @Author houjh
 * @Email: happyxiaohou@gmail.com
 * @Date: 2020-05-29
 * @Copyright (c) 2020-2022 云南昇晖科技有限公司
 */
@RestController
@RequestMapping("/admin/baseRoleUser")
public class BaseRoleUserController {

    @Resource
    private IBaseRoleUserService baseRoleUserService;

    /**
     * 查询用户授权角色树
     */
    @RequestMapping("/getAuditRoleTree")
    public Object getAuditRoleTree(String userId, String id, String code) {
        return baseRoleUserService.getAuditRoleTree(userId, id, code);
    }


    /**
     * 查询用户授权角色列表
     */
    @RequestMapping("/getRoleUserListByUserId")
    public Object getRoleUserListByUserId(@RequestParam Map map) {
        return baseRoleUserService.getRoleUserListByUserId(map);
    }


    /**
     * 添加角色授权信息
     * @param roleId
     * @param userId
     * @return
     */
    @RequestMapping("/addRoleUser")
    public Result addRoleUser(String roleId, String userId){
        return baseRoleUserService.addRoleUser(roleId, userId);
    }

    /**
     * 取消角色授权
     * @param roleId
     * @param userId
     * @return
     */
    @RequestMapping("/removeRoleUser")
    public Result removeRoleUser(String roleId, String userId) {
        return baseRoleUserService.removeRoleUser(roleId, userId);
    }

}
